import request from './request'

export const  getBaseInfo = async()=> {
  let baseInfo = {
    juwei: 60,
    xoaoqu: 458
  }
  Promise.all([getCinemaNum(),getCountSizeGarbage(),getCountWorkOrder(),getAllGarbageRoom()]).then(res=> {
    baseInfo.cameraNum = res[0].data
    baseInfo.CountSizeGarbage = res[1].data
    baseInfo.AllGarbageRoom = res[2].data
    baseInfo.CountWorkOrder = res[3].data
    // baseInfoList.push({name: '摄像头', num: res[0].data})
    // baseInfoList.push({name: '告警垃圾箱', num: res[1].data})
    // baseInfoList.push({name: '告警工单数', num: res[2].data})
    // baseInfoList.push({name: '垃圾厢房', num: res[3].data.totalNum})
    // console.log(baseInfoList)
    return baseInfo
  })
  // await getCinemaNum().then(res=> { baseInfoList.push({name: '摄像头', num: res.data}) })
  // await getCountSizeGarbage().then(res=> {baseInfoList.push({name: '告警垃圾箱', num: res.data})})
  // await getCountWorkOrder().then(res=> {baseInfoList.push({name: '告警工单数', num: res.data})})
  // await getAllGarbageRoom().then(res=> {baseInfoList.push({name: '垃圾厢房', num: res.data.totalNum})})
  // return baseInfoList
}

export const getCinemaNum = () => {
  return request({
    method: 'post',
    url: '/bigdata/streets/garbageroom/cinema/info'
  })
}

export const getCountSizeGarbage = () => {
  return request({
    method: 'post',
    url: '/bigdata/streets/garbageroom/workOrder/countSizeGarbage'
  })
}

export const getCountWorkOrder = () => {
  return request({
    method: 'post',
    url: '/bigdata/streets/garbageroom/workOrder/countSize'
  })
}

export const getAllGarbageRoom = () => {
  return request({
    method: 'post',
    url: '/bigdata/streets/garbageroom/workOrder/allGarbageRoom'
  })
}

export const getWorkOrderList = () => {
  return request({
    method: 'post',
    url: '/bigdata/streets/garbageroom/workOrder/workOrder',
    data: {
      status: '0'
    }
  })
}